<?php
class classBasketsDetail extends phpajax{
	function input(){}
	function loading(){}
	
	function main(){
		$_Window = new classWindow();
		aprint('flow_container2',$_Window->ShowByAJAX('flow_container2',self::getList()));
	}
	
	public function getList(){
        $_Follow = new classFollow();
		//class for importing pricelists
		$_PriceList = new classPriceExport();
		//-----------------------------------------------------------------
		//start making table
		$result ='
			<br>
			<table id="css_basket_detail_content_table">
				<tr>
					<td>
						<b>'._i18n_product_Name_.'</b>
					</td>
					<td>
						<b>'._i18n_product_Code_.'</b>
					</td>
					<td>
						<b>'._i18n_product_UNIT_.'</b>
					</td>
					'.$_PriceList->simpleTableAddOn_header().'
				</tr>
		';
		
		//-----------------------------------------------------------------
		//read session
		$_basket_sess = new classSessions();
		$sSessionString = $_basket_sess->open('ShopBasket');
		
		//-----------------------------------------------------------------
		//go through list from session
		$basket_records 		= explode('/',$sSessionString);
		$basket_records_count 	= count($basket_records);		
		for($iIndex = 0; $iIndex<$basket_records_count; $iIndex++){
			//explode inner array wit information about inserted product
			$basket_records_array = explode(';',$basket_records[$iIndex]);
			//get main product informations from DB
			$sql_object = mysql_fetch_object(mysql_query('select Product_Name, Product_Code, Product_UnitType from products where ID='.$basket_records_array[0]));
			$result .='
				<tr
					onmouseover="this.style.textDecoration=\'underline\';"
					onmouseout="this.style.textDecoration=\'none\';" 
				>
					<td
                      '.$_Follow->getJS($basket_records_array[0]).'
                    >
						'.$sql_object->Product_Name.'
					</td>
					<td>
						'.$sql_object->Product_Code.'
					</td>
					<td>
						'.$sql_object->Product_UnitType.'
					</td>
					'.$_PriceList->simpleTableAddOn_values($basket_records_array[0],$basket_records_array[1]).'
				</tr>
			';
			$products_list[$iIndex] = $basket_records_array[0];
			$counts_list[$iIndex] 	= $basket_records_array[1];
		}
		
		$result .='
				<tr>
					<td colspan="3" class="css_basket_full_price_container">
						<br>
						'.$_PriceList->detailResult($products_list, $counts_list).'
					</td>
				</tr>
			</table>
		';
		
		return $result;
	}
}
?>